package net.opslog.web.client.models;

import java.util.Map;

public class LogEntry extends BaseModel {
	public LogEntry(JSOModel data) {
		super(data);
	}

	public String getMessage() {
		return get("message");
	}

	public String getRawEntry(String logFormat) {
		String text = logFormat;
		for (Map.Entry<String, String> entry : this.getFields().entrySet()) {
			text = text.replace("%" + entry.getKey(), "<span class='logline-"
					+ entry.getKey() + "'>" + entry.getValue() + "</span>");
		}
		text = text.replaceAll("%[^ ]*", "");
		return text;

	}
}
